﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Kevin.Framework.Validation
{
    internal class DateTimeValidator:Validator
    {
        DateTimeType _type = DateTimeType.TimeSpan;

        public DateTimeValidator(DateTimeType type,string messageTemplate, string tag)
            : base(messageTemplate, tag)
        {
            this._type = type;
        }




        /// <summary>
        /// 校验数据
        /// </summary>
        /// <param name="objectToValidate"></param>
        /// <param name="currentTarget"></param>
        /// <param name="key"></param>
        /// <param name="validationResults"></param>
        protected internal override void DoValidate(object objectToValidate,
            object currentTarget,
            string key,
            ValidationResults validationResults)
        {
            //bool isValid = false;

            if (objectToValidate != null)
            {
                //RangeChecker<DateTime> checker = new RangeChecker<DateTime>(this.lowerBound, this.upperBound);
                //isValid = checker.IsInRange((DateTime)objectToValidate);
                switch (_type)
                {
                    case DateTimeType.ShortDate:
                        new RegexValidator("", "").DoValidate(objectToValidate, currentTarget, "", validationResults);
                        break;
                    case DateTimeType.TimeSpan:
                        new RegexValidator("", "").DoValidate(objectToValidate, currentTarget, "", validationResults);
                        break;
                    default:
                        break;
                }
            }

            //if (isValid == false)
            //    RecordValidationResult(validationResults, this.MessageTemplate, currentTarget, key);
        }
    }
}
